﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class viewcardsent : System.Web.UI.Page
{
    private bussiness bus;
    string id;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] != null)
        {
            id = Request.QueryString["id"];
            bus = new bussiness();

            List<Ecard> lstEcard = bus.getAllEcard();
            List<Ecard> lstEcard_display = new List<Ecard>();

            SentEcard se = bus.getSentEcardById(Convert.ToInt32(id));
            Customer c = bus.getCustomerById(se.CustomerId);
            lbltitle.Text = se.Title;
            lblSender.Text = c.Name;
            lblmessage.Text = se.Massage;
            lblSignature.Text = se.Signature;
            foreach (Ecard ecard in lstEcard)
            {
                if (ecard.EcardId == se.EcardId)
                {
                    lstEcard_display.Add(ecard);
                    Repeater1.DataSource = lstEcard_display;
                    Repeater1.DataBind();
                    break;
                }
            }

            
        }
        else
        {
            Response.Redirect("error.aspx");
        }
        


    }


}
